package com.example.domain.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.example.util.page.PageInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 
 * </p>
 *
 * @author readpage
 * @since 2023-02-03 16:15
 */
@Schema(title = "Comment对象")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Comment implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(title = "评论ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @Schema(title = "父节点")
    private Long parentId;

    @Schema(title = "文章id")
    private Long articleId;

    @Schema(title = "用户ID")
    private Long uid;

    @Schema(title = "地址")
    private String address;

    @Schema(title = "评论内容")
    private String content;

    @Schema(title = "点赞数")
    private Integer likes;

    @Schema(title = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @Schema(title = "用户")
    @TableField(exist = false)
    private User user;

    @TableField(exist = false)
    private Reply reply;


    @Data
    public static class Reply extends PageInfo<Comment> {
    }

}
